#include <stdio.h>


typedef union 
{
	short s;
	char c[sizeof(short)];
}un;


int main(int argc, char **argv)
{
	un _un;
	_un.s = 0x0102;
	if(sizeof(short)==2)
	{
		printf("address 0:%x\taddress 1:%x\n", &_un.c[0], &_un.c[1]);
		printf("value 0:%d\tvalue 1:%d\n", _un.c[0], _un.c[1]);
		if(_un.c[0]==1 && _un.c[1]==2)
			printf("Big endian\n");
		else if(_un.c[0]==2 && _un.c[1]==1)
			printf("little endian\n");
		else
			printf("unknown");
	}
	else
		printf("sizeof(short):%ul\n", sizeof(short));
	return 0;
}
